import _Vue, { PluginObject } from "vue";

import VirLoading from './loading';


declare module "vue/types/vue" {
    interface Vue {
        $$loading: VirLoading;
    }
}

/** 暴露 Loading插件 */
export const loading: VirLoading = new VirLoading();

/** 暴露 Loading插件初始化 */
export const LoadingPlugin: PluginObject<string> = {
    install: function (Vue: typeof _Vue, option: any = {}) {
        Vue.prototype.$$loading = loading;
        Vue.prototype.$$loading.lock = option.lock;
        Vue.prototype.$$loading.spinner = option.spinner;
        Vue.prototype.$$loading.background = option.background;
        Vue.prototype.$$loading.fullscreen = option.fullscreen;
    }
};

/** 默认 暴露Loading插件初始化 */
export default LoadingPlugin;
